package com.yufei.toolinterface.util;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;

public class EntityButton extends JButton{




	public EntityButton(final Object source,String label,final JDialog parent) {
		super(label);
		
		
		//add listener
		this.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				JDialog dialog= DialogUtil.CreateDialogForCustomerObj(parent, false, source);
				dialog.pack();
				 dialog.setVisible(true);
			}
		});
	}

	public EntityButton(final Object source,String label,final JFrame parent) {
		super(label);
		
		
		//add listener
		this.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				JDialog dialog= DialogUtil.CreateDialogForCustomerObj(parent, true, source);
				dialog.pack();
			    dialog.setVisible(true);
			}
		});
	}


	
}